package cl.android.mochileros;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;


public class MainActivity extends Activity {
	Button btnLogin;
//	Button btnFbLogin;
	TextView txUser;
	TextView txPassword;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        baseDatos();
        txUser = (TextView) findViewById(R.id.txUser);
        txPassword = (TextView) findViewById(R.id.txPassword);
        
        btnLogin = (Button) findViewById(R.id.btnLogin);
        btnLogin.setOnClickListener(new OnClickListener() {
			public void onClick(View v) {
				doLogin();
			}
		});
//        btnFbLogin = (Button) findViewById(R.id.btnFbLogin);
//        btnFbLogin.setOnClickListener(new OnClickListener() {
//			public void onClick(View v) {
//				doFbLogin();
//			}
//		});
    }
    
    public void baseDatos(){
//    	MochilerosSQLiteHelper mochilerosDBH = new MochilerosSQLiteHelper(this, "DBMochileros", null, 3);
//    	mochilerosDBH.onCreate(mochilerosDBH.getWritableDatabase());
//    	mochilerosDBH.onUpgrade(mochilerosDBH.getWritableDatabase(), 2, 3);
//    	mochilerosDBH.onUpgrade(db, oldVersion, newVersion)
//    	SQLiteDatabase db = mochilerosDBH.getWritableDatabase();
//    	
//    	if(db != null){
//    		db.execSQL("INSERT INTO Lugar (id_lugar, nombre, lat, long, imagen)" + " VALUES (1,'lugar1',-38.764018, -72.663477, '1' )");
//    		db.close();
//    	}
    	
//    	List<Lugar> listaLugares = lugarDao.buscarPorExample(null);
//    	for (Lugar lugar2 : listaLugares) {
//			System.out.println(lugar2.getNombre());
//		}
    }
    
    public void doLogin(){
    	Intent act = new Intent(this,MapActivity.class);
    	startActivity(act);
    }
    
    public void doFbLogin(){
    	
    }
    
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();
        if (id == R.id.action_settings) {
            return true;
        }
        return super.onOptionsItemSelected(item);
    }
}
